<?php
	require '../utils/conn.php';
	include_once '../models/machine.php';
	
	$title = $_REQUEST['title'];
	$update = $_REQUEST['update'];
	$machineType = $_REQUEST['machineType'];
	$content = $_REQUEST['content'];
	$examType = $_REQUEST['examType'];
	
	$machine = new Machine();
	$machine->setTitle($title);
	$machine->setUpdate($update);
	$machine->setMachineType($machineType);
	$machine->setContent($content);
	$machine->setExamtype($examType);
	$machine->setTimestamp(time());
	
	$query = "INSERT INTO t_machine(type, title, update_info, exam_type, content, timestamp)" . " VALUES($machineType,'$title','$update',$examType,'$content','$machine->timestamp')";
	$result = mysql_query($query) or die("insert set failed：". mysql_error());
	$machine->machineId = mysql_insert_id();
	echo $machine->machineId;
?>